[ios][precompile] add support for clang virtual file system#54842
Closed
[ios][precompile] add support for clang virtual file system#54842
Conversation
Job Summary for GradleTest All :: run_fantom_tests
|
Job Summary for GradleTest All :: run_fantom_tests
|
3e2aec1 to
ed64fda
Compare
Job Summary for GradleTest All :: run_fantom_tests
|
cipolleschi
approved these changes
Dec 16, 2025
Contributor
cipolleschi
left a comment
There was a problem hiding this comment.
It makes sense. I trust that you tested it out!
cipolleschi
approved these changes
Dec 17, 2025
d0c3305 to
b1fdfaf
Compare
ba99f11 to
2ddcbd1
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D90674493. |
cortinico
approved these changes
Jan 21, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
cipolleschi
approved these changes
Jan 26, 2026
|
|
||
| require_relative './utils.rb' | ||
|
|
||
| ### Adds ReactNativeCore-prebuilt as a dependency to the given podspec if we're not |
Replace the regex-based approach for parsing podspec files with a declarative configuration system for header file collection: Add headers-config.js with explicit podspec configurations defining header patterns, directories, and subspecs - Add vfs.js to generate VFS overlay YAML files for Clang virtual file system support - Refactor headers.js to use the new configuration-based approach with support for nested subspecs and path preservation - Update xcframework.js to handle the new header mapping structure with source/target paths - This provides more reliable and maintainable header file collection for XCFramework builds by avoiding fragile regex parsing of Ruby podspec files.
Now it reads from podspec files, except for some special cases that we have in the config file. Updated RCTSwiftUIWrapper.podspec to use podspec_sources (which we use to detect source) I tested this against the header files I got with the previous iteration, and also with the ones installed by Cocoapods.
To solve our problem with header files from the React.XCFramework not being consumable due to the legacy Cocoapods headers, we used to point all header search / resolving into the Pods/Headers folder when building even with the framework installed. This is a problem since an xcframework expects a modular header structure that can be consumed from within the headers folder of the framework. The headers are used for both Objective-c compiling and for creating clang modules that can be consumed by Swift in our setup. This commit fixes the above issues and makes a modular clang virtual file system from the header files we distribute. This vfs-overlay file will then be used by the `rncore.rb` script when installing the 'React-Core-prebuilt' pod and map the header files requested in the source code to the actual location on disk where the React.xcframework headers are installed. Here are the changes: - Added vfs.js with types for creating clang virtual file system overlays - Added resolving the paths in the vfs file to the actual install path - Added installing the vfs overlay with the switch `-ivfsoverlay <path>` to compiler settings for both obj-c and swift on pod installation - Add vfs targets to the app target on post install
Had some podspecs with header_dir set to a variable that wasn't emitted correctly in the VFS file. This commit fixes this by adding explicit reading of header-dir as well as exceptions for the specs that had variables. - Tested comparing the output from a regular pod install with the generated header files. - Tested with RNTester - Tested in BareExpo with prebuild Expo modules and full compile.
Tried to build some smartness in last comitt - not working in a generic way so I reverted it. This is handled by the exception in header-config.js instead.
…te targets when installing This one uses installer.pod_targets.each to do this. Added helper function to avoid code ducplication.
2ddcbd1 to
7fea6c5
Compare
meta-codesync bot
pushed a commit
that referenced
this pull request
Jan 27, 2026
Summary: Replace the regex-based approach for parsing podspec files with a declarative configuration system for header file collection: Add headers-config.js with explicit podspec configurations defining header patterns, directories, and subspecs - Add vfs.js to generate VFS overlay YAML files for Clang virtual file system support - Refactor headers.js to use the new configuration-based approach with support for nested subspecs and path preservation - Update xcframework.js to handle the new header mapping structure with source/target paths - This provides more reliable and maintainable header file collection for XCFramework builds by avoiding fragile regex parsing of Ruby podspec files. Prev PR: #54840 Next PR: #54842 bypass-github-export-checks ## Changelog: [IOS] [FIXED] - refactored header files generator for prebuilt React framework Pull Request resolved: #54841 Test Plan: Run RNTester with prebuilt Reviewed By: cortinico Differential Revision: D90674355 Pulled By: cipolleschi fbshipit-source-id: 66ec997a8731b6bf91a8f3c2ab42a94e7b0601e8
|
@cipolleschi merged this pull request in f0422ab. |
meta-codesync bot
pushed a commit
that referenced
this pull request
Feb 5, 2026
… on iOS (#55394) Summary: When the user switches from Debug -> Release we'll replace the React-Core-prebuilt XCFramework. Previously we nuked the ios/Pods/React-Core-prebuilt folder - but after we added support for VFS overlays to honor header files in the XCFramework this folder will also contain the VFS-file (React-VFS.yaml) which shouldn't be removed. Removing this file causes an error when building. This commit fixes this by deleting all directories inside the Pods/React-Core-prebuilt folder, leaving any files (React-VFS.yaml) untouched. I've tested this in a new project and in RN-Tester and it works. I measured the size of the XCFramework when switching between Debug/Release to confirm that the switch still works. I also changed the name of the podspec script since it showd RNDeps and not RNCore. This issue was introduced in #54842 and not yet released in any version. ## Changelog: [IOS] [FIXED] - Fixed replace script deleting the react-vfs.yaml file on iOS Pull Request resolved: #55394 Test Plan: Run RN-Tester with precompiled binaries and build both release and debug. Reviewed By: cortinico Differential Revision: D92159099 Pulled By: cipolleschi fbshipit-source-id: 3ae7bd03431b225672ac4b4f7b91e6ef44765019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
To solve our problem with header files from the React.XCFramework not being consumable due to the legacy Cocoapods headers, we used to point all header search / resolving into the Pods/Headers folder when building even with the framework installed.
This is a problem since an xcframework expects a modular header structure that can be consumed from within the headers folder of the framework.
The headers are used for both Objective-c compiling and for creating clang modules that can be consumed by Swift in our setup.
This commit fixes the above issues and makes a modular clang virtual file system from the header files we distribute. This vfs-overlay file will then be used by the
rncore.rbscript when installing the 'React-Core-prebuilt' pod and map the header files requested in the source code to the actual location on disk where the React.xcframework headers are installed.Here are the changes:
-ivfsoverlay <path>to compiler settings for both obj-c and swift on pod installationPrev PR: #54841
Changelog:
[IOS] [FIXED] - added support for clang virtual file system in React.XCFramework
Test Plan:
Run RNTester with prebuilt